<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>重点监管企业视图</title>
</head>
<body class="skin-default">

<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12">
            <!--视图块-->
            <div class="container-fluid card">
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--检索栏-->
                        <form class="form-inline search-bar" id="pageForm">
                            <div class="form-group">
                                <label class="control-label">企业名称：&nbsp;</label>
                                <input type="text" name="enterprisename" class="form-control">
                            </div>
                            <div class="form-group">
                                <label class="control-label">行业：&nbsp;</label>
                                <!--<input type="text" name="industry" class="form-control">-->
                                <select  name="industry" value="" class="form-control">
                                    <option value=""></option>
                                    <option value="有色金属冶炼">有色金属冶炼</option>
                                    <option value="石油加工">石油加工</option>
                                    <option value="化工">化工</option>
                                    <option value="焦化">焦化</option>
                                    <option value="电镀">电镀</option>
                                    <option value="制革">制革</option>
                                    <option value="其他">其他</option>
                                </select>
                            </div>

                            <div class="form-group" style="float: left"  >
                                <label class="control-label" style="float: left" >省：&nbsp;</label>
                                <select  style="width: 120px" name="provinceCode" id="provinceCode" class="joSelect form-control" data='' firstItem='{"id":"","name":""}'
                                         dataurl="" keyfield="id" valuefield="name"></select>
                            </div>
                            <div class="form-group" style="float: left;border: 1px;" >
                                <label class="control-label" style="float: left" >市：&nbsp;</label>
                                <select  style="width: 120px" name="cityCode" id="cityCode" class="joSelect form-control" data='' firstItem='{"id":"","name":""}' dataurl="" keyfield="id" valuefield="name"></select>
                            </div>
                            <div class="form-group" style="float: left">
                                <label class="control-label" style="float: left">县：&nbsp;</label>
                                <select style="width: 120px" name="countyCode" id="countyCode" class="joSelect form-control" data='' firstItem='{"id":"","name":""}' dataurl="" keyfield="id" valuefield="name"></select>
                            </div>






                            <button type="button" class="btn btn-primary" onclick="joView.select()"> <i class="fa fa-search" aria-hidden="true"></i>&nbsp;查询</button>
                        </form>
                        <!--/检索栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <!--按钮栏-->
                        <div class="form-group button-bar">
                            <!--按钮占位符.加载到的按钮会渲染到占位符里面-->
                            <span class="young-button-placeholder" navigateId="NAV_TYPE_HTML_BUTTON"></span>
                            <span class="young-button-placeholder" navigateId="QY_VIEW_BUTTON"></span>
                            <span class="young-button-placeholder" navigateId="QY_LOCK_BUTTON"></span>
                           <!-- <button type="button" class="btn btn-primary" onclick="joView.lock()">
                                <i class="fa fa-lock" aria-hidden="true"></i>&nbsp;锁定
                            </button>
                            <button type="button" class="btn btn-default" onclick="joView.unlock()">
                                <i class="fa fa-lock" aria-hidden="true"></i>&nbsp;解锁
                            </button>-->
                            <!--<button isShow="" type="button" class="btn btn-primary" onclick="joView.add()">
                                <i class="fa fa-plus" aria-hidden="true"></i>&nbsp;新增
                            </button>
                            <button type="button" class="btn btn-danger" onclick="joView.del()">
                                <i class="fa fa-trash-o" aria-hidden="true"></i>&nbsp;删除
                            </button>
                            <button type="button" class="btn btn-warning" onclick="window.location.reload()">
                                <i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;刷新
                            </button>
                            <button type="button" class="btn btn-warning" onclick="exportConfig()">
                                <i class="fa fa-refresh" aria-hidden="true"></i>&nbsp;导出
                            </button>-->
                        </div>
                        <!--/按钮栏-->
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <div class="table-bar">
                            <!--grid-->
                            <div class="table-responsive">
                                <table class="layui-table table-bordered table-hover" id="mainList" dataUrl="/nyd/uviSuperviseenterprises/getPage" deleteUrl="/nyd/uviSuperviseenterprises/delete" lockUrl="/nyd/uviSuperviseenterprises/lock" unlockUrl="/nyd/uviSuperviseenterprises/unlock" formUrl="/page/nyd/uviSuperviseenterprisesForm.html">
                                    <!--<col field="id" title="序号" width="5%" align="" event="click" />-->
                                    <col field="enterprisename" title="企业名称" width="25%" align="" event="click" />
                                    <col field="regions" title="行政区划分" width="10%" align=""  />
                                    <col field="industry" title="行业" width="15%" align=""  />
                                    <col field="lng" title="经度" width="8%" align=""  />
                                    <col field="lat" title="纬度" width="8%" align=""  />
                                    <col field="unlack" title="锁定" width="8%" align="" />
                                    <col field="_opt" title="操作" width="20%" align=""/>
                                </table>
                            </div>
                            <!--/grid-->
                            <!--分页条-->
                            <div class="page-bar" gridId="mainList">

                            </div>
                            <!--/分页条-->
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    $(function(){

        //初始化省市县联动
        initProvinceCityCounty('provinceCode', 'cityCode', 'countyCode');
        joView.init({grid:$("#mainList"),PKName:"id",formWidth:"1200px",exportUrl:"/nyd/uviSuperviseenterprises/export"});//初始化页面
        initButton();
    });
    //表格渲染时行处理,参数1为当前行的数据对象,参数2为当前行的索引值(最小为0)
    joView.handleItem = function(oItem,iIndex){
        oItem.unlack = formatUnlack(oItem.unlack);
        oItem._opt = '<button type="button" class="btn btn-sm btn-outline btn-primary" onclick="pollutionList(\''+oItem.id+'\')"> <i class="fa fa-magic" aria-hidden="true"></i>&nbsp;污染物</button>' +
            '&nbsp;<button type="button" class="btn btn-sm btn-outline btn-info" onclick="listthzardousList(\''+oItem.organizationcode+'\')"> <i class="fa fa-magic" aria-hidden="true"></i>&nbsp;有害物质</button>'+
            '&nbsp;<button type="button" class="btn btn-sm btn-outline btn-success" onclick="enterpriseUpload(\''+oItem.organizationcode+'\')"> <i class="fa fa-magic" aria-hidden="true"></i>&nbsp;附件</button>'
        ;
    };

    //格式化锁定状态
    function formatUnlack(unlack){
        if(unlack == 0){
            return '<span class="label label-primary">未锁定</span>';
        }else{
            return '<span class="label label-danger">锁定</span>';
        }
    }
    //跳转
    function enterpriseUpload(id){
        if(id){
            top.jo.showWin("/page/nyd/enterpriseUpload.html?id="+id,"1600px","800px","企业附件","企业附件",false,true);    }
    };
    //跳转
    function pollutionList(id){
        if(id){
            top.jo.showWin("/page/nyd/uviPollutiontreatmentList.html?enterprisecode="+id,"1600px","800px","污染物清单","污染物清单",false,true);    }
    };
    //跳转 查看有害物质清单
    function listthzardousList(id){
        if(id){
            top.jo.showWin("/page/nyd/uviListhazardousList.html?enterprisecode="+id,"1600px","800px","有害物质清单","有害物质清单",false,true);    }
    };
    //导出
    function exportConfig(){
        var ids = jo.getCheckBoxValue("id");
        if(!ids){
            jo.confirm("确定要导出全部吗？",function (index) {
                jo.post("/nyd/uviSuperviseenterprises/export",{ids:ids});
                layer.close(index);
            });

        }else{
            jo.confirm("确定要导出选中的数据吗？",function (index) {
                jo.post("/nyd/uviSuperviseenterprises/export", {ids:ids});
                layer.close(index);
            });
        }
    }
    /*//导入配置
    function importConfig(){
        jo.uploadFile("{URL_CMS}cms/genMain/recover", function (success, file, json) {
            if(success && json.code == 0){
                jo.showMsg("恢复成功!", {icon:1});
            }else{
                jo.showMsg("操作失败!", {icon:2});
            }
            jo.closeUploadDialog();
            joView.reloadCurrentPage();
        }, {UPLOAD_FILE_TYPES:'gen',fileNumLimit:1})
    }*/
    //表格渲染完成后的回调,参数为表格数据(数组对象)
    joView.setGridDataAfter = function(oList){

    };
    /* 关于joView更多回调函数和配置参数可查看jo-page-view.js */
</script>
</body>
</html>
